package net.begincode.SSO.service;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import net.begincode.SSO.bean.SsoUser;
import net.begincode.SSO.mapper.UserMapper;

/**
 * 用户业务层
 * @author 遗忘
 * @date 2017.4.17
 *
 */
@Service
@Transactional
public class UserService  {
	@Resource
	private UserMapper mapper;

	
	public void addUser(SsoUser user){
		mapper.addUser(user);
	}
	
	/**
	 * 通过邮箱查找用户
	 * @param email
	 * @return
	 */
	public SsoUser findUserByEmail(String email){
		return mapper.findUserByEmail(email);
	}
	
	/**
	 * 通过openId查找用户
	 * @param openId
	 * @return
	 */
	public SsoUser findUserByOpenId(String openId){
		return mapper.findUserByOpenId(openId);
	}
	
}
